﻿using LibNiconico.NiconicoApi.Extentions;
using LibNiconico.NiconicoApi.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LibNiconico.NiconicoApi.Login
{
    class NicoLoginQueryInfo:NicoUrlEncodedPostAble
    {

        internal NicoLoginQueryInfo(string mail, string password)
        {
            this.Mail = mail;
            this.Password = password;
        }

        internal override byte[] AsPostData()
        {
            var queryStrings = new QueryStrings();
            queryStrings.Add(PostName.MAIL, Mail);
            queryStrings.Add(PostName.PASSWORD, Password);

            return Encoding.UTF8.GetBytes(queryStrings.ToString());
        }

        internal override string AsPath()
        {
            return "secure/login";
        }

        internal override string AsQuery()
        {
            return "";
        }


        private static class PostName
        {
            internal const string MAIL = "mail";

            internal const string PASSWORD = "password";
        }

        internal string Mail { get; set; }

        internal string Password { get; set; }
    }
}
